import java.util.HashSet;
import java.util.TreeSet;

/**
 * Created with IntelliJ IDEA.
 * Description:https://leetcode.cn/problems/jewels-and-stones/description/
 * User: dings
 * Date: 2024-07-24
 * Time: 9:07
 */
public class Test {
    public int numJewelsInStones(String jewels, String stones) {
        HashSet<Character> hashSet = new HashSet<>();
        for(int i = 0;i < jewels.length();i++) {
            char ch = jewels.charAt(i);
            hashSet.add(ch);
        }
        int count = 0;
        for(int i = 0;i < stones.length();i++) {
            if(hashSet.contains(stones.charAt(i))) {
                count++;
            }
        }
        return count;
    }
    public static void main(String[] args) {

    }
}
